home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWAROPER_H
- #define FWAROPER_H
- //========================================================================================
- //
- // File: FWArOper.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWARDYNA_H
- #include "FWArDyna.h"
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // operator>>
- //
- // Global template function for reading from a readableArchive. The type 'tDynamicClass'
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- template <class tDynamicClass>
- FW_CReadableArchive & operator>>(FW_CReadableArchive & readableArchive,
- tDynamicClass* & object)
- {
- void * voidPtr = (void *)object;
- FW_CDynamicArchiver::InputObject(readableArchive, voidPtr);
- object = (tDynamicClass *)voidPtr;
-
- #ifdef FW_DEBUG
- // Cause a compile-time error if 'tDynamicClass' is a static type
- tDynamicClass* debugPtr = FW_DYNAMIC_CAST(tDynamicClass, object);
-
- // Cause a run-time error if 'debugPtr' is 0.
- FW_ASSERT(debugPtr);
- #endif
-
- return readableArchive;
- }
-
- //----------------------------------------------------------------------------------------
- // operator>>
- //
- // Specialization for type 'char *'.
- //----------------------------------------------------------------------------------------
-
- inline FW_CReadableArchive & operator>>(FW_CReadableArchive & readableArchive,
- char *nullTerminatedString)
- {
- ((FW_CReadableStream &)readableArchive).operator>>(nullTerminatedString);
-
- return readableArchive;
- }
-
- //----------------------------------------------------------------------------------------
- // operator<<
- //
- // Global template function for writing to a writableArchive. The type 'tDynamicClass' must
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- template <class tDynamicClass>
- FW_CWritableArchive & operator<<(FW_CWritableArchive & writableArchive,
- const tDynamicClass * object)
- {
- FW_CDynamicArchiver::OutputObject(writableArchive, object, FW_CLASSNAME_FROM_POINTER(object));
-
- return writableArchive;
- }
-
- //----------------------------------------------------------------------------------------
- // operator<<
- //
- // Specialization for type 'const char *'.
- //----------------------------------------------------------------------------------------
-
- inline FW_CWritableArchive & operator<<(FW_CWritableArchive & writableArchive,
- const char *nullTerminatedString)
- {
- ((FW_CWritableStream &)writableArchive).operator<<(nullTerminatedString);
-
- return writableArchive;
- }
-
- #endif